﻿using System;
using DevExpress.Xpo;

namespace DataModel.Models
{
    /// <summary>
    /// Класс страхового полиса
    /// </summary>
    public class InsurancePolicy : BasePersistObject
    {
        public InsurancePolicy(Session session)
            : base(session)
        {
        }
        protected InsurancePolicy()
        {
        }
        protected InsurancePolicy(Session session, DevExpress.Xpo.Metadata.XPClassInfo classInfo)
            : base(session, classInfo)
        {
        }

        private string _Number;
        /// <summary>
        /// Номер
        /// </summary>
        [DevExpress.Xpo.DisplayName("Номер")]
        public string Number
        {
            get
            {
                return _Number;
            }
            set
            {
                SetPropertyValue("Number", ref _Number, value);
            }
        }

        private DateTime _SignDate;
        /// <summary>
        /// Дата оформления
        /// </summary>
        [DevExpress.Xpo.DisplayName("Дата оформления")]
        public DateTime SignDate
        {
            get
            {
                return _SignDate;
            }
            set
            {
                SetPropertyValue("SignDate", ref _SignDate, value);
            }
        }

        private DateTime _StartDate;
        /// <summary>
        /// Дата начала действия
        /// </summary>
        [DevExpress.Xpo.DisplayName("Дата начала действия")]
        public DateTime StartDate
        {
            get
            {
                return _StartDate;
            }
            set
            {
                SetPropertyValue("StartDate", ref _StartDate, value);
            }
        }

        private DateTime _EndDate;
        /// <summary>
        /// Дата окончания действия
        /// </summary>
        [DevExpress.Xpo.DisplayName("Дата окончания действия")]
        public DateTime EndDate
        {
            get
            {
                return _EndDate;
            }
            set
            {
                SetPropertyValue("EndDate", ref _EndDate, value);
            }
        }
        private Product _Product;
        /// <summary>
        /// Страховой продукт
        /// </summary>
        [DevExpress.Xpo.DisplayName("Страховой продукт")]
        public Product Product
        {
            get
            {
                return _Product;
            }
            set
            {
                SetPropertyValue("Product", ref _Product, value);
            }
        }

        private InsuranceCompany _InsuranceCompany;
        /// <summary>
        /// Страховая компания
        /// </summary>
        [DevExpress.Xpo.DisplayName("Страховая компания")]
        public InsuranceCompany InsuranceCompany
        {
            get
            {
                return _InsuranceCompany;
            }
            set
            {
                SetPropertyValue("InsuranceCompany", ref _InsuranceCompany, value);
            }
        }
        private Client _Client;
        /// <summary>
        /// Клиент
        /// </summary>
        [DevExpress.Xpo.DisplayName("Клиент")]
        [Association("Client-InsurancePolicies")]
        public Client Client
        {
            get
            {
                return _Client;
            }
            set
            {
                SetPropertyValue("Client", ref _Client, value);
            }
        }
        private int _StateID;
        /// <summary>
        /// Статус
        /// </summary>
        [DevExpress.Xpo.DisplayName("Статус")]
        public int StateID
        {
            get
            {
                return _StateID;
            }
            set
            {
                SetPropertyValue("StateID", ref _StateID, value);
            }
        }

        private Money _Bonus;
        /// <summary>
        /// Премия
        /// </summary>
        [DevExpress.Xpo.DisplayName("Премия")]
        [Persistent("Bonus")]
        public Money Bonus
        {
            get
            {
                return _Bonus;
            }
            set
            {
                SetPropertyValue("Bonus", ref _Bonus, value);
            }
        }
        private Money _Franchise;
        [DevExpress.Xpo.DisplayName("Франшиза")]
        [Persistent("Franchise")]
        public Money Franchise
        {
            get
            {
                return _Franchise;
            }
            set
            {
                SetPropertyValue("Franchise", ref _Franchise, value);
            }
        }
        private Money _InsuranceSum;
        [DevExpress.Xpo.DisplayName("Страховая сумма")]
        [Persistent("InsuranceSum")]
        public Money InsuranceSum
        {
            get
            {
                return _InsuranceSum;
            }
            set
            {
                SetPropertyValue("InsuranceSum", ref _InsuranceSum, value);
            }
        }
        /// <summary>
        /// Бланки
        /// </summary>
        [Association("InsurancePolicy-Blanks")]
        [DevExpress.Xpo.DisplayName("Бланки")]
        public XPCollection<Blank> Blanks
        {
            get
            {
                return GetCollection<Blank>("Blanks");
            }
        }
        /// <summary>
        /// Взносы
        /// </summary>
        [DevExpress.Xpo.DisplayName("Взносы")]
        [Association("InsurancePolicy-Payments")]
        public XPCollection<Payment> Payments
        {
            get
            {
                return GetCollection<Payment>("Payments");
            }
        }
    }
}
